package at.socialconference.web.client.ui;

import java.util.HashMap;

import at.socialconference.inter.model.Talk;

import com.google.gwt.user.client.ui.ListBox;

public class ListBoxTalks extends ListBox {
	private HashMap<Integer, Talk> mapTalks = new HashMap<Integer, Talk>();
	public void addTalk(Talk Talk) {
		mapTalks.put(Talk.getId(), Talk);
		addItem(Talk.getTitle(), Talk.getId().toString());
	}
	public Talk getSelectedTalk() {
		try {
			int id = Integer.parseInt(getValue(getSelectedIndex()));
			return mapTalks.get(id);
		} catch (Exception e) {
			return null;
		}
	}
}